/*
 *   Clovis
 *   Copyright (C) 2008 SFWOL
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#include "Clovis.h"

#include <SDL/SDL.h>
//#include <GL/GL.h>

namespace clovis {

	ClovisEngine::ClovisEngine(){

		this->version = "ClovisEngine ver. 0.0.1-dev";
		this->authors = "MARTIN Damien & THERY-HERMAIN Romain";
		this->license = "GNU/GPL 3";
		this->web = "http://www.sfwol.org";

		// Writing headers on output
		std::cout << "|| " << this->version.toCharArray() << std::endl << "||" << std::endl;
		std::cout << "|| " << "Authors : " << this->authors.toCharArray() << std::endl;
		std::cout << "|| " << "License : " << this->license.toCharArray() << std::endl;
		std::cout << "|| " << "Web site : " << this->web.toCharArray() << std::endl;
		std::cout << std::endl << std::endl;

		// Initialize the two internal ClovisVariable Trees
		this->user_variables = new core::Tree();
		this->clovis_variables = new core::Tree( new core::CString("clovis","clovis") );

		// Creates the video node
		core::Node * curr = this->clovis_variables->getRoot();
		curr = curr->addNode( new core::CString("video","video") );

		// Add default values to the video node
		curr->addNode( new core::CInteger("width", 1024) );
		curr->addNode( new core::CInteger("height", 768) );
		curr->addNode( new core::CInteger("depth", 32) );
		curr->addNode( new core::CInteger("fullscreen", 0) );

		video_device = NULL;



        std::cout << std::endl;
		clovis_variables->print();




	}

	void ClovisEngine::createSystemWindow(){

		if(video_device == NULL){

			video_device = new video::VideoDevice(640, 480);

		}else{

			io::Log::logOn(io::WARNING , "The video output has already been set","errors.log");

		}

	}

	core::Tree * ClovisEngine::getClovisVariables(){

		return this->clovis_variables;

	}

	core::Tree * ClovisEngine::getUserVariables(){

		return this->user_variables;

	}

};
